package edu.sctu.xialei.june.day20150614one.file.test;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/**
 * Created by Administrator on 2015/6/14.
 */
//  File to create folder,File and delete it

public class FileUtil {

    private Scanner input = new Scanner(System.in);

    public void createFolder() {
        System.out.println("type the path");

        File file = new File(input.next());

        if (!file.exists()) {
            file.mkdirs();
        }
    }

    public void createFile() {
        System.out.println("type the path");

        File file = new File(input.next());

        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public void delete() {
        System.out.println("type the path");

        File file = new File(input.next());

        if (file.exists()) {
            file.delete();
        }
    }
}
